package com.gxa.saas.service.impl;

import com.gxa.saas.mapper.WarehouseMapper;
import com.gxa.saas.pojo.Warehouse;
import com.gxa.saas.service.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: yx
 * @Date: 2022/6/7 16:14
 */
@Service("warehouseService")
public class WarehouseServiceImpl implements WarehouseService {

    @Autowired
    WarehouseMapper warehouseMapper;

    @Override
    public List<Warehouse> selectAll() {
        return warehouseMapper.selectAll();
    }

    @Override
    public Integer selectAllNumber() {
        return warehouseMapper.selectAllNumber();
    }

    @Override
    public List<Warehouse> selectByPage(Integer offset) {
        return warehouseMapper.selectByPage((offset-1)*10, 10);
    }

    @Override
    public void insert(Warehouse warehouse) {
        warehouseMapper.insert(warehouse);
    }

    @Override
    public void update(Warehouse warehouse) {
        warehouseMapper.update(warehouse);
    }

    @Override
    public void delete(Integer id) {
        warehouseMapper.delete(id);
    }


    @Override
    public List<Warehouse> selectLikeName(Map map) {
        return warehouseMapper.selectLikeName(map);
    }

    @Override
    public void updateIsUsed(Integer id,Boolean isUsed) {
        Warehouse warehouse = new Warehouse();
        warehouse.setId(id);
        warehouse.setIsUsed(isUsed);
        warehouseMapper.updateIsUsed(warehouse);
    }


}
